home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / DOS_.H < prev    next >
C/C++ Source or Header  |  1992-03-22  |  3KB  |  71 lines

  1. /* Copyright (C) 1991, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* dos.h */
  21. /* Generic DOS interface for Ghostscript */
  22.  
  23. /* This file is needed because the Borland and Watcom compilers */
  24. /* provide slightly different procedures for interfacing to DOS and */
  25. /* the I/O hardware, and because the Watcom compiler is 32-bit. */
  26. #include <dos.h>
  27. #ifdef __WATCOMC__
  28.  
  29. /* ---------------- Watcom compiler, 32-bit flat model. */
  30. /* ---------------- inp/outp prototypes are in conio.h, not dos.h. */
  31.  
  32. #  include <conio.h>
  33. #  define inportb(px) inp(px)
  34. #  define outportb(px,b) outp(px,b)
  35. #  define enable() _enable()
  36. #  define disable() _disable()
  37. #  define MK_PTR(seg,off) (((seg) << 4) + (off))
  38. #  define PTR_OFF(ptr) ((unsigned)(ptr) & 0xffff)
  39. #  define int86 int386
  40. #  define int86x int386x
  41. /* Fetch and discard a byte.  Prevent the compiler from */
  42. /* optimizing this away. */
  43. static unsigned char byte_discard_;
  44. #  define byte_discard(expr) byte_discard_ = (expr)
  45. /* Define the regs union tag for short registers. */
  46. #  define rshort w
  47. /* Define the structure and procedures for file enumeration. */
  48. #define ff_struct_t struct find_t
  49. #define ff_name name
  50. #define dos_findfirst(n,b) _dos_findfirst(n, _A_NORMAL | _A_RDONLY, b)
  51. #define dos_findnext(b) _dos_findnext(b)
  52.  
  53. #else
  54.  
  55. /* ---------------- Borland compiler, 16:16 pseudo-segmented model. */
  56. /* ---------------- ffblk is in dir.h, not dos.h. */
  57. #include <dir.h>
  58. #  define MK_PTR(seg,off) MK_FP(seg,off)
  59. #  define PTR_OFF(ptr) FP_OFF(ptr)
  60. #  define PTR_SEG(ptr) FP_SEG(ptr)
  61. /* Fetch and discard a byte.  No special cleverness required. */
  62. #  define byte_discard(expr) byte discard = (expr)
  63. /* Define the regs union tag for short registers. */
  64. #  define rshort x
  65. /* Define the structure and procedures for file enumeration. */
  66. #define ff_struct_t struct ffblk
  67. #define dos_findfirst(n,b) findfirst(n, b, 0)
  68. #define dos_findnext(b) findnext(b)
  69.  
  70. #endif
  71.